package net.wanglu.www.zzz.utils;

import java.util.Properties;

import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.trees.GrammaticalStructureFactory;
import edu.stanford.nlp.trees.PennTreebankLanguagePack;
import edu.stanford.nlp.trees.TreebankLanguagePack;

public class StanfordUtilsCore {
	
	private static StanfordCoreNLP stanfordCoreNLP = null;
	public static StanfordCoreNLP getStanfordCoreNLP() throws Exception {
		if ( stanfordCoreNLP == null) {
		    Properties props = new Properties();
		    props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
		    stanfordCoreNLP = new StanfordCoreNLP(props);				
		}
		return stanfordCoreNLP;
	}
	
	private static GrammaticalStructureFactory gsf = null;
	public static GrammaticalStructureFactory getGrammaticalStructureFactory() throws Exception {
		if ( gsf == null ) {
			TreebankLanguagePack tlp = new PennTreebankLanguagePack();
			gsf = tlp.grammaticalStructureFactory();			
		}

		return gsf;
	}
}
